<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="个人博客">
    <meta name="keyword"  content="">
    <link rel="shortcut icon" href="/img/favicon.ico">

    <title>
        
        Hexo + Gitee 搭建个人博客 - undefined
        
    </title>

    <!-- Custom CSS -->
    <link rel="stylesheet" href="/css/aircloud.css">
    <link rel="stylesheet" href="/css/gitment.css">
    <!--<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">-->
    <link href="//at.alicdn.com/t/font_620856_pl6z7sid89qkt9.css" rel="stylesheet" type="text/css">
    <!-- ga & ba script hoook -->
    <script></script>
</head>

<body>

<div class="site-nav-toggle" id="site-nav-toggle">
    <button>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
    </button>
</div>

<div class="index-about">
    <i>  </i>
</div>

<div class="index-container">
    
    <div class="index-left">
        
<div class="nav" id="nav">
    <div class="avatar-name">
        <div class="avatar ">
            <img src="/" />
        </div>
        <div class="name">
            <i>loong</i>
        </div>
    </div>
    <div class="contents" id="nav-content">
        <ul>
            <li >
                <a href="/">
                    <i class="iconfont icon-shouye1"></i>
                    <span>主页</span>
                </a>
            </li>
            <li >
                <a href="/tags">
                    <i class="iconfont icon-biaoqian1"></i>
                    <span>标签</span>
                </a>
            </li>
            <li >
                <a href="/archives">
                    <i class="iconfont icon-guidang2"></i>
                    <span>存档</span>
                </a>
            </li>
            <li >
                <a href="/about/">
                    <i class="iconfont icon-guanyu2"></i>
                    <span>关于</span>
                </a>
            </li>
            
        </ul>
    </div>
    
        <div id="toc" class="toc-article">
    <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#Hexo-Gitee-搭建个人博客"><span class="toc-text">Hexo + Gitee 搭建个人博客</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#安装Node-js"><span class="toc-text">安装Node.js</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-Node-js-配置环境变量"><span class="toc-text">1. Node.js 配置环境变量</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-换源"><span class="toc-text">2. 换源</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#安装Git"><span class="toc-text">安装Git</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#安装Hexo"><span class="toc-text">安装Hexo</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-安装Hexo"><span class="toc-text">1.    安装Hexo</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-配置Hexo环境变量"><span class="toc-text">2.    配置Hexo环境变量</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#不更改Nodejs配置情况下，默认的全局配置在安装路径下"><span class="toc-text">#不更改Nodejs配置情况下，默认的全局配置在安装路径下</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#初始化Hexo"><span class="toc-text">初始化Hexo</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1-创建空文件-一定要为空文件，若不是则清空"><span class="toc-text">1.    创建空文件(一定要为空文件，若不是则清空)</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-进入文件夹，并初始化"><span class="toc-text">2.    进入文件夹，并初始化</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3-文件目录说明"><span class="toc-text">3.    文件目录说明</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#4-运行Hello-World"><span class="toc-text">4.    运行Hello World</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#5-修改主题"><span class="toc-text">5.    修改主题</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-进入相关网站查询你中意的主题https-hexo-io-themes"><span class="toc-text">1.    进入相关网站查询你中意的主题https://hexo.io/themes/</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#2-在github上查找字体仓库，并clone"><span class="toc-text">2.    在github上查找字体仓库，并clone</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#3-修改主题"><span class="toc-text">3.    修改主题</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#6-部署"><span class="toc-text">6.    部署</span></a></li></ol></li></ol></li></ol></li></ol>
</div>
    
</div>


<div class="search-field" id="search-field">
    <div class="search-container">
        <div class="search-input">
            <span id="esc-search"> <i class="icon-fanhui iconfont"></i></span>
            <input id="search-input"/>
            <span id="begin-search">搜索</span>
        </div>
        <div class="search-result-container" id="search-result-container">

        </div>
    </div>
</div>

        <div class="index-about-mobile">
            <i>  </i>
        </div>
    </div>
    
    <div class="index-middle">
        <!-- Main Content -->
        


<div class="post-container">
    <div class="post-title">
        Hexo + Gitee 搭建个人博客
    </div>

    <div class="post-meta">
        <span class="attr">发布于：<span>2019-11-04 21:00:22</span></span>
        
        </span>
        <span class="attr">访问：<span id="busuanzi_value_page_pv"></span>
</span>
</span>
    </div>
    <div class="post-content ">
        <p>[TOC]</p>
<h1 id="Hexo-Gitee-搭建个人博客"><a href="#Hexo-Gitee-搭建个人博客" class="headerlink" title="Hexo + Gitee 搭建个人博客"></a>Hexo + Gitee 搭建个人博客</h1><h2 id="安装Node-js"><a href="#安装Node-js" class="headerlink" title="安装Node.js"></a>安装Node.js</h2><h3 id="1-Node-js-配置环境变量"><a href="#1-Node-js-配置环境变量" class="headerlink" title="1. Node.js 配置环境变量"></a>1. Node.js 配置环境变量</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Win10 安装默认添加</span><br></pre></td></tr></table></figure>



<h3 id="2-换源"><a href="#2-换源" class="headerlink" title="2. 换源"></a>2. 换源</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">#以下命令若不做特殊声明，皆在Git Bash中执行</span><br><span class="line">$:npm config set registry http://registry.npm.taobao.org/</span><br></pre></td></tr></table></figure>



<h2 id="安装Git"><a href="#安装Git" class="headerlink" title="安装Git"></a>安装Git</h2><h2 id="安装Hexo"><a href="#安装Hexo" class="headerlink" title="安装Hexo"></a>安装Hexo</h2><h3 id="1-安装Hexo"><a href="#1-安装Hexo" class="headerlink" title="1.    安装Hexo"></a>1.    安装Hexo</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$:npm install -g hexo-cli</span><br></pre></td></tr></table></figure>

<h3 id="2-配置Hexo环境变量"><a href="#2-配置Hexo环境变量" class="headerlink" title="2.    配置Hexo环境变量"></a>2.    配置Hexo环境变量</h3><h4 id="不更改Nodejs配置情况下，默认的全局配置在安装路径下"><a href="#不更改Nodejs配置情况下，默认的全局配置在安装路径下" class="headerlink" title="#不更改Nodejs配置情况下，默认的全局配置在安装路径下"></a>#不更改Nodejs配置情况下，默认的全局配置在安装路径下</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$:$&#123;NodeJs安装位置&#125;\node_global\node_modules\hexo-cli\bin  添加入Path中</span><br></pre></td></tr></table></figure>

<h3 id="初始化Hexo"><a href="#初始化Hexo" class="headerlink" title="初始化Hexo"></a>初始化Hexo</h3><h4 id="1-创建空文件-一定要为空文件，若不是则清空"><a href="#1-创建空文件-一定要为空文件，若不是则清空" class="headerlink" title="1.    创建空文件(一定要为空文件，若不是则清空)"></a>1.    创建空文件(一定要为空文件，若不是则清空)</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">空文件夹为：D:\HexoBlog</span><br></pre></td></tr></table></figure>

<h4 id="2-进入文件夹，并初始化"><a href="#2-进入文件夹，并初始化" class="headerlink" title="2.    进入文件夹，并初始化"></a>2.    进入文件夹，并初始化</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$:cd /d/HexoBlog</span><br><span class="line">$:hexo init</span><br></pre></td></tr></table></figure>

<p><img src="/.com//1572873555296.png" alt="1572873555296"></p>
<p><img src="/.com//1572873577540.png" alt="1572873577540"></p>
<h4 id="3-文件目录说明"><a href="#3-文件目录说明" class="headerlink" title="3.    文件目录说明"></a>3.    文件目录说明</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">_config.yml：		站点的配置文件，需要备份；</span><br><span class="line">themes：				主题文件夹，需要备份；</span><br><span class="line">source：				博客文章的 .md 文件，需要备份；</span><br><span class="line">scaffolds：			文章的模板，需要备份；</span><br><span class="line">package.json：		安装包的名称，需要备份；</span><br><span class="line">.gitignore：			限定在 push 时哪些文件可以忽略，需要备份；</span><br><span class="line">.git：				主题和站点都有，标志这是一个 git 项目，不需要备份；</span><br><span class="line">node_modules：		是安装包的目录，在执行 npm install 的时候会重新生成，不需要备份；</span><br><span class="line">public：				是 hexo g 生成的静态网页，不需要备份；</span><br><span class="line">.deploy_git：		同上，hexo g 也会生成，不需要备份；</span><br><span class="line">db.json：			文件，不需要备份。</span><br></pre></td></tr></table></figure>

<h4 id="4-运行Hello-World"><a href="#4-运行Hello-World" class="headerlink" title="4.    运行Hello World"></a>4.    运行Hello World</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo s</span><br></pre></td></tr></table></figure>

<p><img src="/.com//1572874367010.png" alt="1572874367010"></p>
<p># 此时打开[ <a href="http://localhost:4000/" target="_blank" rel="noopener">http://localhost:4000</a>]即可在本地网页看到Hello World</p>
<p><img src="/.com//1572874538086.png" alt="1572874538086"></p>
<h4 id="5-修改主题"><a href="#5-修改主题" class="headerlink" title="5.    修改主题"></a>5.    修改主题</h4><h5 id="1-进入相关网站查询你中意的主题https-hexo-io-themes"><a href="#1-进入相关网站查询你中意的主题https-hexo-io-themes" class="headerlink" title="1.    进入相关网站查询你中意的主题https://hexo.io/themes/"></a>1.    进入相关网站查询你中意的主题<a href="https://hexo.io/themes/" target="_blank" rel="noopener">https://hexo.io/themes/</a></h5><h5 id="2-在github上查找字体仓库，并clone"><a href="#2-在github上查找字体仓库，并clone" class="headerlink" title="2.    在github上查找字体仓库，并clone"></a>2.    在github上查找字体仓库，并clone</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git clone https://github.com/iissnan/hexo-theme-next themes/$&#123;主题名&#125;  # 下载主题到themes下面的&#123;主题名&#125;文件夹下</span><br></pre></td></tr></table></figure>

<h5 id="3-修改主题"><a href="#3-修改主题" class="headerlink" title="3.    修改主题"></a>3.    修改主题</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$: vim _config.yum</span><br><span class="line">#将theme后默认的主题名landscape 更改为你上一步中的$&#123;主题名&#125;(文件夹名)  并保存退出</span><br><span class="line">$:hexo s --debug		#重启服务，用debug的模式启动</span><br></pre></td></tr></table></figure>

<h4 id="6-部署"><a href="#6-部署" class="headerlink" title="6.    部署"></a>6.    部署</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$:hexo d -g</span><br></pre></td></tr></table></figure>

<p>![1572938621103](Hexo + Gitee 搭建个人博客.assets/1572938621103.png)</p>

        
        <br />
        <div id="comment-container">
        </div>
        <div id="disqus_thread"></div>

        <div id="lv-container">
        </div>

    </div>
</div>

    </div>
</div>


<footer class="footer">
    <ul class="list-inline text-center">
        
        

        

        

        

        

    </ul>
    
    <p>
        <span id="busuanzi_container_site_pv">
            <span id="busuanzi_value_site_pv"></span>PV
        </span>
        <span id="busuanzi_container_site_uv">
            <span id="busuanzi_value_site_uv"></span>UV
        </span>
        Created By <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>  Theme <a href="https://github.com/aircloud/hexo-theme-aircloud" target="_blank" rel="noopener">AirCloud</a></p>
</footer>




</body>

<script>
    // We expose some of the variables needed by the front end
    window.hexo_search_path = ""
    window.hexo_root = "/"
    window.isPost = true
</script>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="/js/index.js"></script>
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>




</html>
